package org.linlinjava.litemall.db.dao;

import java.util.List;

import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.linlinjava.litemall.db.domain.LitemallGiftCardUser;
import org.linlinjava.litemall.db.domain.LitemallGiftCardUserExample;

public interface LitemallGiftCardUserMapper extends MPJBaseMapper<LitemallGiftCardUser> {
    long countByExample(LitemallGiftCardUserExample example);

    int deleteByExample(LitemallGiftCardUserExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(LitemallGiftCardUser record);

    int insertSelective(LitemallGiftCardUser record);

    LitemallGiftCardUser selectOneByExample(LitemallGiftCardUserExample example);

    LitemallGiftCardUser selectOneByExampleSelective(@Param("example") LitemallGiftCardUserExample example, @Param("selective") LitemallGiftCardUser.Column ... selective);

    List<LitemallGiftCardUser> selectByExampleSelective(@Param("example") LitemallGiftCardUserExample example, @Param("selective") LitemallGiftCardUser.Column ... selective);

    List<LitemallGiftCardUser> selectByExample(LitemallGiftCardUserExample example);

    LitemallGiftCardUser selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") LitemallGiftCardUser.Column ... selective);

    LitemallGiftCardUser selectByPrimaryKey(Integer id);

    LitemallGiftCardUser selectByPrimaryKeyWithLogicalDelete(@Param("id") Integer id, @Param("andLogicalDeleted") boolean andLogicalDeleted);

    int updateByExampleSelective(@Param("record") LitemallGiftCardUser record, @Param("example") LitemallGiftCardUserExample example);

    int updateByExample(@Param("record") LitemallGiftCardUser record, @Param("example") LitemallGiftCardUserExample example);

    int updateByPrimaryKeySelective(LitemallGiftCardUser record);

    int updateByPrimaryKey(LitemallGiftCardUser record);

    int logicalDeleteByExample(@Param("example") LitemallGiftCardUserExample example);

    int logicalDeleteByPrimaryKey(Integer id);

    @Select("SELECT sum(amount) FROM litemall_gift_card_user WHERE user_id = #{userId}")
    Double getCardBalanceTotal(Integer userId);
}